package com.biz.primus.model.member.vo;

import com.biz.primus.model.member.enums.AddressTypes;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

/**
 * @author jun.liu
 * @date 2017年10月22日
 * @reviewer
 * @see
 */
@ApiModel(description = " vo")
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class MemberAddressLabelVo extends BaseVo implements Comparable<MemberAddressLabelVo>
{

    //标签名称
    @ApiModelProperty("标签名称")
    private String labelName;

    /**
     * 关联会员详情Member对象
     */
    @ApiModelProperty("关联会员详情Member对象")
    private Long memberId;

    /**
     * 标签类型
     */
    @ApiModelProperty("标签类型")
    private AddressTypes labelType;

    @Override
    public int compareTo(MemberAddressLabelVo vo) {
        if (this.getLabelType() != null && vo.getLabelType() != null) {
            if (this.getLabelType().getValue() == AddressTypes.home.getValue()) {
                return -1;
            } else if (vo.getLabelType().getValue() == AddressTypes.home.getValue()) {
                return 1;
            } else if (this.getLabelType().getValue() == AddressTypes.company.getValue() && vo.getLabelType().getValue() != AddressTypes.company.getValue()) {
                return -1;
            } else if (vo.getLabelType().getValue() == AddressTypes.company.getValue() && this.getLabelType().getValue() != AddressTypes.company.getValue()) {
                return 1;
            } else if (this.getLabelType().getValue() == AddressTypes.school.getValue() && vo.getLabelType().getValue() != AddressTypes.school.getValue()) {
                return -1;
            } else if (vo.getLabelType().getValue() == AddressTypes.school.getValue() && this.getLabelType().getValue() != AddressTypes.school.getValue()) {
                return 1;
            } else if (this.getLabelType().getValue() == AddressTypes.other.getValue()) {
                return 1;
            } else if (vo.getLabelType().getValue() == AddressTypes.other.getValue()) {
                return -1;
            } else {
                return 0;
            }
        }
        return 0;
    }

}
